<template>
  <div class="guanxianxinxi">
    <el-tree
      :data="treedata"
      :props="defaultProps"
      @node-click="handleNodeClick"
      default-expand-all
    ></el-tree>
  </div>
</template>

<script>
export default {
  data() {
    return {
      dataList: null,
      defaultProps: {
        children: "children",
        label: "chan_name",
      },
   
    };
  },
  props: {
    treedata: {
      type: Array,
      default: function () {
        return [];
      },
    },
  },
  watch: {
    // GuanXianData: {
    //   handler(newVal, oldVal) {
    //     let paramType = (value, type) =>
    //       Object.prototype.toString.call(value).includes(type);
    //     if (paramType(newVal, "Object")) {
    //       console.log(newVal, "newVal");
    //       // delete newVal.item
    //       this.dataList = newVal;
    //       this.getGwTreeDataFunction(newVal.chanCode);
    //     }
    //   },
    //   immediate: true,
    // },
  },
  methods: {
    // async getGwTreeDataFunction(chancode) {
    //   // let chancode1 = "ltejdg_1";
    //   const { data: res } = await getGwTreeData({ code: chancode });
    //   console.log(res);
    //   if (res[0].children.length == 0) {
    //     this.$emit("guanxianxinxidata", false);
    //     this.treedata = [];
      
    //     return;
    //   } else {
    //     this.$emit("guanxianxinxidata", true);
    //     this.treedata = res;
        
    //   }
    // },
    handleNodeClick(data) {
      console.log(data);
    },
  },
};
</script>

<style lang="scss" scoped>
.guanxianxinxi {
  width: 100%;
  height: 160px;
  /* color: #fff; */
}
.guanxianxinxi /deep/ .el-tree {
  height: 160px;
  background: rgba(2, 32, 61, 0.1) !important;
  color: #D8EEFD !important;
  overflow-y: scroll;
}
.guanxianxinxi /deep/ .el-tree-node > .el-tree-node__children {
  // overflow: hidden;
  // background-color: #a5a5a5;
  // height: 160px;
  // overflow-y: scroll;
}
.guanxianxinxi /deep/ .el-tree-node:focus > .el-tree-node__content {
  background-color: #04396d;
}
</style>
